import { Module } from '@nestjs/common';
import { XiaomanService } from './xiaoman.service';
import { XiaomanController } from './xiaoman.controller';
import { LoggerModule } from 'nestjs-pino';

@Module({
  imports: [
    LoggerModule.forRoot({
      pinoHttp: {
        transport: process.env.NODE_ENV ? {
          target: 'pino-pretty',
          options: {
            colorize: true
          }
        } : {
          target: 'pino-roll',    // 自动生成日志
          options: {
            file: 'log.txt',
            frequency: 'daily',
            size: '10m', // 10mb后一个文件
            mkdir: true
          }
        }
      }
    }),
  ],
  controllers: [XiaomanController],
  providers: [XiaomanService],
})
export class XiaomanModule { }
